package Vista;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.rmi.RemoteException;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

import VO.RodamientoVO;

import conexion.ProxyIR;



/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class ModificarGanaciaGUI extends javax.swing.JFrame {
	/**
	 * 
	 */
	private static final long serialVersionUID = 3979765167333432230L;
	private JTextField jTextValorGanacia;
	private JButton jButton1;
	private JButton jButton2;
	private JLabel jLabel1;
	private ProxyIR server;
	static private ModificarGanaciaGUI instance;
	/**
	* Auto-generated main method to display this JFrame
	*/
	
	static public ModificarGanaciaGUI getInstance() {
		if (instance == null) {			
			instance = new ModificarGanaciaGUI();
		}
		
		return instance;
	}
	

	
	public ModificarGanaciaGUI() {
		super();
		this.setLocationRelativeTo(null);
		this.setVisible(true);
		this.
		server = ProxyIR.getInstance();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("Configurar Ganancia");
			getContentPane().setLayout(null);
			{
				jTextValorGanacia = new JTextField();
				getContentPane().add(jTextValorGanacia, "Center");
				jTextValorGanacia.setBounds(132, 47, 79, 23);
				Float ganancia = ProxyIR.getInstance().getPorcentajeGananciaCPR();
				jTextValorGanacia.setText(String.valueOf(ganancia));
			}
			{
				jLabel1 = new JLabel();
				getContentPane().add(jLabel1);
				jLabel1.setText("Valor de Ganancia");
				jLabel1.setBounds(17, 48, 103, 20);
			}
			{
				jButton1 = new JButton();
				getContentPane().add(jButton1);
				jButton1.setText("Guardar");
				jButton1.setBounds(50, 127, 82, 23);
				jButton1.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {	
						server.setPorcentajeGananciaCPR(Float.parseFloat(jTextValorGanacia.getText()));
						instance = null;
						dispose();

					}
				});
			}
			{
				jButton2 = new JButton();
				getContentPane().add(jButton2);
				jButton2.setText("Cancelar");
				jButton2.setBounds(143, 127, 85, 23);
				jButton2.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						instance = null;
						dispose();
					}
				});
			}
			pack();
			this.setSize(268, 200);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}

}
